package com.czx.drivingtest.utils;

import cn.hutool.core.util.StrUtil;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author czx
 * @version 2021/8/10 9:45 下午
 */
public class ConvertUtil {
    public static List<Integer> strSplit2IntList(String str, String delimiter) {
        return Arrays.stream(str.split(delimiter))
                .map(item -> {
                    if (StrUtil.isBlank(item) || "null".equals(item)) {
                        return null;
                    }
                    return Integer.valueOf(item);
                })
                .collect(Collectors.toList());
    }
}
